﻿namespace Cars.Console.Factory
{
    using Geometry;
    using Models;
    using System;
    using System.Collections.Generic;
    public class CarFactory
    {
        public CarFactory()
        {
        }

        public Car CreateTrafficCar(int x, int y)
        {
            var carType = Randomizer.Next(0, 2);

            if (carType == 0)
                return new GVCar(new Coordinate(x, y));
            else
                return new DrunkDriver(new Coordinate(x, y));
        }

        public IEnumerable<Car> GetCarsCollection(int num)
        {
            var result = new List<Car>();
            var random = new Random();
            for (int i = 0; i < num; i++)
            {
                int x = random.Next(9, 20);
                int y = random.Next(9, 20);
                result.Add(new DrunkDriver(new Coordinate(x, y)));
            }

            for (int i = 0; i < 3; i++)
            {
                int x = random.Next(9, 20);
                int y = random.Next(9, 20);
                result.Add(new GVCar(new Coordinate(x, y)));
            }

            return result;
        }
    }
}
